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

Commit 0d91cbe3 authored by Shinru Han's avatar Shinru Han
Browse files

Reland "Add IAGnssRil AIDL HAL (hardware/interfaces)"

Bug: 205185251
Bug: 182975915
Test: atest VtsHalGnssTargetTest
Change-Id: I7f8d0b367c68ba870d0a222aee4ee4b5b93cc936
parent 8e5df9ba
Loading
Loading
Loading
Loading
+79 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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 IAGnssRil {
  void setCallback(in android.hardware.gnss.IAGnssRilCallback callback);
  void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
  void setSetId(in android.hardware.gnss.IAGnssRil.SetIDType type, in @utf8InCpp String setid);
  void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes);
  const int NETWORK_CAPABILITY_NOT_METERED = 1;
  const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
  @Backing(type="int") @VintfStability
  enum AGnssRefLocationType {
    GSM_CELLID = 1,
    UMTS_CELLID = 2,
    LTE_CELLID = 4,
    NR_CELLID = 8,
  }
  @Backing(type="int") @VintfStability
  enum SetIDType {
    NONE = 0,
    IMSI = 1,
    MSISDM = 2,
  }
  @VintfStability
  parcelable AGnssRefLocationCellID {
    android.hardware.gnss.IAGnssRil.AGnssRefLocationType type;
    int mcc;
    int mnc;
    int lac;
    long cid;
    int tac;
    int pcid;
    int arfcn;
  }
  @VintfStability
  parcelable AGnssRefLocation {
    android.hardware.gnss.IAGnssRil.AGnssRefLocationType type;
    android.hardware.gnss.IAGnssRil.AGnssRefLocationCellID cellID;
  }
  @VintfStability
  parcelable NetworkAttributes {
    long networkHandle;
    boolean isConnected;
    int capabilities;
    @utf8InCpp String apn;
  }
}
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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 IAGnssRilCallback {
  void requestSetIdCb(in int setIdflag);
  void requestRefLocCb();
}
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ interface IGnss {
  @nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence();
  @nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage();
  android.hardware.gnss.IAGnss getExtensionAGnss();
  android.hardware.gnss.IAGnssRil getExtensionAGnssRil();
  android.hardware.gnss.IGnssDebug getExtensionGnssDebug();
  android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl();
  void start();
+166 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.IAGnssRilCallback;
import android.hardware.gnss.IAGnssRilCallback.SetIDType;

/**
 * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
 * Layer interface allows the GNSS chipset to request radio interface layer
 * information from Android platform. Examples of such information are reference
 * location, unique subscriber ID, phone number string and network availability changes.
 */
@VintfStability
interface IAGnssRil {
    /** Network capability mode bitmask for not metered. */
    const int NETWORK_CAPABILITY_NOT_METERED = 0x01;

    /** Network capability mode bitmask for not roaming. */
    const int NETWORK_CAPABILITY_NOT_ROAMING = 0x02;

    /** AGNSS reference location type */
    @VintfStability
    @Backing(type="int")
    enum AGnssRefLocationType {
        GSM_CELLID = 1,
        UMTS_CELLID = 2,
        LTE_CELLID = 4,
        NR_CELLID = 8,
    }

    /** SET ID type*/
    @VintfStability
    @Backing(type="int")
    enum SetIDType {
        NONE = 0,
        IMSI = 1,
        MSISDM = 2,
    }

    /**
     * CellID for 2G, 3G ,LTE and NR used in AGNSS. This is defined in
     * UserPlane Location Protocol (Version 2.0.4).
     */
    @VintfStability
    parcelable AGnssRefLocationCellID {
        AGnssRefLocationType type;

        /** Mobile Country Code. */
        int mcc;

        /** Mobile Network Code .*/
        int mnc;

        /**
         * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
         * lac is populated with tac, to ensure that we don't break old clients that
         * might rely on the old (wrong) behavior.
         */
        int lac;

        /**
         *  Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE.
         *  Cell Global Id NR in 5G.
         */
        long cid;

        /** Tracking Area Code in LTE and NR. */
        int tac;

        /** Physical Cell id in LTE and NR (not used in 2G and 3G) */
        int pcid;

        /** Absolute Radio Frequency Channel Number in NR. */
        int arfcn;
    }

    /** Represents ref locations */
    @VintfStability
    parcelable AGnssRefLocation {
        AGnssRefLocationType type;

        AGnssRefLocationCellID cellID;
    }

    /** Represents network connection status and capabilities. */
    @VintfStability
    parcelable NetworkAttributes {
        /** Network handle of the network for use with the NDK API. */
        long networkHandle;

        /**
         * True indicates that network connectivity exists and it is possible to
         * establish connections and pass data. If false, only the networkHandle field
         * is populated to indicate that this network has just disconnected.
         */
        boolean isConnected;

        /**
         * A bitfield of flags indicating the capabilities of this network. The bit masks are
         * defined in NETWORK_CAPABILITY_*.
         */
        int capabilities;

        /**
         * Telephony preferred Access Point Name to use for carrier data connection when
         * connected to a cellular network. Empty string, otherwise.
         */
        @utf8InCpp String apn;
    }

    /**
     * Opens the AGNSS interface and provides the callback routines
     * to the implementation of this interface.
     *
     * @param callback Interface for AGnssRil callbacks.
     *
     */
    void setCallback(in IAGnssRilCallback callback);

    /**
     * Sets the reference location.
     *
     * @param agnssReflocation AGNSS reference location CellID.
     *
     */
    void setRefLocation(in AGnssRefLocation agnssReflocation);

    /**
     * Sets the SET ID.
     *
     * @param type Must be populated with either IMSI or MSISDN or NONE.
     * @param setid If type is IMSI then setid is populated with
     * a string representing the unique Subscriber ID, for example, the IMSI for
     * a GMS phone. If type is MSISDN, then setid must contain
     * the phone number string for line 1. For example, the MSISDN for a GSM phone.
     * If the type is NONE, then the string must be empty.
     *
     */
    void setSetId(in SetIDType type, in @utf8InCpp String setid);

    /**
     * Notifies GNSS of network status changes.
     *
     * The framework calls this method to update the GNSS HAL implementation of network
     * state changes.
     *
     * @param attributes Updated network attributes.
     *
     */
    void updateNetworkState(in NetworkAttributes attributes);
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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;

/**
 * Callback for IAGnssRil interface. Used to request SET ID and
 * Reference Location.
 */
@VintfStability
interface IAGnssRilCallback {
    /**
     * The Hal uses this API to request a SET ID.
     *
     * @param setIdflag A bitfield of IAGnssRil.SetIDType that is required by
     * the HAL. The framework will inject an empty SET ID if the flag is NONE.
     *
     */
    void requestSetIdCb(in int setIdflag);

    /**
     * The Hal uses this API to request a reference location.
     */
    void requestRefLocCb();
}
Loading