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

Commit a7f4e053 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio: Implement ITelephony core interface for telecom

Implement telecom functions in ITelephony corresponding
to the IPrimaryDevice in the HIDL HAL.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia83fa4341dd50919d885ac1e10fb31c9a30c5a86
parent b771f08a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ interface IStreamIn {
  void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata);
  float[] getHwGain();
  void setHwGain(in float[] channelGains);
  const int MIC_FIELD_DIMENSION_WIDE_ANGLE = -1;
  const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1);
  const int MIC_FIELD_DIMENSION_NO_ZOOM = 0;
  const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1;
  const int HW_GAIN_MIN = 0;
+17 −0
Original line number Diff line number Diff line
@@ -36,4 +36,21 @@ package android.hardware.audio.core;
interface ITelephony {
  android.hardware.audio.core.AudioMode[] getSupportedAudioModes();
  void switchAudioMode(android.hardware.audio.core.AudioMode mode);
  android.hardware.audio.core.ITelephony.TelecomConfig setTelecomConfig(in android.hardware.audio.core.ITelephony.TelecomConfig config);
  @JavaDerive(equals=true, toString=true) @VintfStability
  parcelable TelecomConfig {
    @nullable android.media.audio.common.Float voiceVolume;
    android.hardware.audio.core.ITelephony.TelecomConfig.TtyMode ttyMode = android.hardware.audio.core.ITelephony.TelecomConfig.TtyMode.UNSPECIFIED;
    @nullable android.media.audio.common.Boolean isHacEnabled;
    const int VOICE_VOLUME_MIN = 0;
    const int VOICE_VOLUME_MAX = 1;
    @Backing(type="int") @VintfStability
    enum TtyMode {
      UNSPECIFIED = (-1),
      OFF = 0,
      FULL = 1,
      HCO = 2,
      VCO = 3,
    }
  }
}
+4 −4
Original line number Diff line number Diff line
@@ -37,15 +37,15 @@ parcelable MicrophoneInfo {
  @utf8InCpp String id;
  android.media.audio.common.AudioDevice device;
  android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN;
  int group = -1;
  int indexInTheGroup = -1;
  int group = GROUP_UNKNOWN;
  int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
  @nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity;
  android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN;
  android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse;
  @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position;
  @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation;
  const int GROUP_UNKNOWN = -1;
  const int INDEX_IN_THE_GROUP_UNKNOWN = -1;
  const int GROUP_UNKNOWN = (-1);
  const int INDEX_IN_THE_GROUP_UNKNOWN = (-1);
  @Backing(type="int") @VintfStability
  enum Location {
    UNKNOWN = 0,
+4 −4
Original line number Diff line number Diff line
@@ -39,12 +39,12 @@ parcelable StreamDescriptor {
  int frameSizeBytes;
  long bufferSizeFrames;
  android.hardware.audio.core.StreamDescriptor.AudioBuffer audio;
  const int LATENCY_UNKNOWN = -1;
  const int LATENCY_UNKNOWN = (-1);
  @FixedSize @VintfStability
  parcelable Position {
    long frames = -1;
    long timeNs = -1;
    const long UNKNOWN = -1;
    long frames = UNKNOWN;
    long timeNs = UNKNOWN;
    const long UNKNOWN = (-1);
  }
  @Backing(type="int") @VintfStability
  enum State {
+73 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package android.hardware.audio.core;

import android.hardware.audio.core.AudioMode;
import android.media.audio.common.Boolean;
import android.media.audio.common.Float;

/**
 * An instance of ITelephony manages settings which are specific to voice calls
@@ -53,4 +55,75 @@ interface ITelephony {
     * @throws EX_ILLEGAL_STATE If there was an error during switching.
     */
    void switchAudioMode(AudioMode mode);

    @JavaDerive(equals=true, toString=true)
    @VintfStability
    parcelable TelecomConfig {
        const int VOICE_VOLUME_MIN = 0;
        const int VOICE_VOLUME_MAX = 1;
        /**
         * Volume of a voice call. 1.0f means unity gain, 0.0f is muted,
         * see VOLUME_* constants.
         */
        @nullable Float voiceVolume;
        /**
         * The current mode of teletypewritter (TTY).
         */
        @VintfStability
        @Backing(type="int")
        enum TtyMode {
            /**
             * The default uninitialized value.
             */
            UNSPECIFIED = -1,
            /**
             * TTY mode is off.
             */
            OFF = 0,
            /**
             * TTY mode is on. The speaker is off and the microphone is muted. The
             * user will communicate with the remote party by sending and receiving
             * text messages.
             */
            FULL = 1,
            /**
             * TTY mode is in hearing carryover mode (HCO). The microphone is muted
             * but the speaker is on. The user will communicate with the remote
             * party by sending text messages and hearing an audible reply.
             */
            HCO = 2,
            /**
             * TTY mode is in voice carryover mode (VCO). The speaker is off but the
             * microphone is still on. User will communicate with the remote party
             * by speaking and receiving text message replies.
             */
            VCO = 3,
        }
        TtyMode ttyMode = TtyMode.UNSPECIFIED;
        /**
         * Whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is enabled.
         */
        @nullable Boolean isHacEnabled;
    }

    /**
     * Set the configuration of the telephony audio.
     *
     * In the provided parcelable, the client sets zero, one or more parameters
     * which have to be updated on the HAL side. The parameters that are left
     * unset must retain their current values.
     *
     * In the returned parcelable, all parameter fields known to the HAL module
     * must be populated to their current values.The client can pass an
     * uninitialized parcelable in order to retrieve the current configuration.
     *
     * @return The current configuration (after update). All fields known to
     *         the HAL must be populated.
     * @param config The configuration to set. Any number of fields may be left
     *               uninitialized.
     * @throws EX_UNSUPPORTED_OPERATION If telephony is not supported.
     * @throws EX_ILLEGAL_ARGUMENT If the requested combination of parameter
     *                             values is invalid.
     */
    TelecomConfig setTelecomConfig(in TelecomConfig config);
}
Loading