Loading audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl +17 −0 Original line number Original line Diff line number Diff line Loading @@ -36,4 +36,21 @@ package android.hardware.audio.core; interface ITelephony { interface ITelephony { android.hardware.audio.core.AudioMode[] getSupportedAudioModes(); android.hardware.audio.core.AudioMode[] getSupportedAudioModes(); void switchAudioMode(android.hardware.audio.core.AudioMode mode); 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, } } } } audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ package android.hardware.audio.effect; @VintfStability @VintfStability union HapticGenerator { union HapticGenerator { android.hardware.audio.effect.VendorExtension vendorExtension; android.hardware.audio.effect.VendorExtension vendorExtension; android.hardware.audio.effect.HapticGenerator.HapticScale hapticScale; android.hardware.audio.effect.HapticGenerator.HapticScale[] hapticScales; android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo; android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo; @VintfStability @VintfStability union Id { union Id { Loading audio/aidl/android/hardware/audio/core/ITelephony.aidl +73 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package android.hardware.audio.core; package android.hardware.audio.core; import android.hardware.audio.core.AudioMode; 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 * An instance of ITelephony manages settings which are specific to voice calls Loading Loading @@ -53,4 +55,75 @@ interface ITelephony { * @throws EX_ILLEGAL_STATE If there was an error during switching. * @throws EX_ILLEGAL_STATE If there was an error during switching. */ */ void switchAudioMode(AudioMode mode); 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); } } audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -90,6 +90,6 @@ union HapticGenerator { float maxAmplitude; float maxAmplitude; } } HapticScale hapticScale; HapticScale[] hapticScales; VibratorInformation vibratorInfo; VibratorInformation vibratorInfo; } } audio/aidl/default/Telephony.cpp +33 −0 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,17 @@ #include "core-impl/Telephony.h" #include "core-impl/Telephony.h" using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Float; namespace aidl::android::hardware::audio::core { namespace aidl::android::hardware::audio::core { Telephony::Telephony() { mTelecomConfig.voiceVolume = Float{TelecomConfig::VOICE_VOLUME_MAX}; mTelecomConfig.ttyMode = TelecomConfig::TtyMode::OFF; mTelecomConfig.isHacEnabled = Boolean{false}; } ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector<AudioMode>* _aidl_return) { ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector<AudioMode>* _aidl_return) { *_aidl_return = mSupportedAudioModes; *_aidl_return = mSupportedAudioModes; LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return); LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return); Loading @@ -38,4 +47,28 @@ ndk::ScopedAStatus Telephony::switchAudioMode(AudioMode in_mode) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } ndk::ScopedAStatus Telephony::setTelecomConfig(const TelecomConfig& in_config, TelecomConfig* _aidl_return) { if (in_config.voiceVolume.has_value() && (in_config.voiceVolume.value().value < TelecomConfig::VOICE_VOLUME_MIN || in_config.voiceVolume.value().value > TelecomConfig::VOICE_VOLUME_MAX)) { LOG(ERROR) << __func__ << ": voice volume value is invalid: " << in_config.voiceVolume.value().value; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } if (in_config.voiceVolume.has_value()) { mTelecomConfig.voiceVolume = in_config.voiceVolume; } if (in_config.ttyMode != TelecomConfig::TtyMode::UNSPECIFIED) { mTelecomConfig.ttyMode = in_config.ttyMode; } if (in_config.isHacEnabled.has_value()) { mTelecomConfig.isHacEnabled = in_config.isHacEnabled; } *_aidl_return = mTelecomConfig; LOG(DEBUG) << __func__ << ": received " << in_config.toString() << ", returning " << _aidl_return->toString(); return ndk::ScopedAStatus::ok(); } } // namespace aidl::android::hardware::audio::core } // namespace aidl::android::hardware::audio::core Loading
audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl +17 −0 Original line number Original line Diff line number Diff line Loading @@ -36,4 +36,21 @@ package android.hardware.audio.core; interface ITelephony { interface ITelephony { android.hardware.audio.core.AudioMode[] getSupportedAudioModes(); android.hardware.audio.core.AudioMode[] getSupportedAudioModes(); void switchAudioMode(android.hardware.audio.core.AudioMode mode); 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, } } } }
audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ package android.hardware.audio.effect; @VintfStability @VintfStability union HapticGenerator { union HapticGenerator { android.hardware.audio.effect.VendorExtension vendorExtension; android.hardware.audio.effect.VendorExtension vendorExtension; android.hardware.audio.effect.HapticGenerator.HapticScale hapticScale; android.hardware.audio.effect.HapticGenerator.HapticScale[] hapticScales; android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo; android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo; @VintfStability @VintfStability union Id { union Id { Loading
audio/aidl/android/hardware/audio/core/ITelephony.aidl +73 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package android.hardware.audio.core; package android.hardware.audio.core; import android.hardware.audio.core.AudioMode; 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 * An instance of ITelephony manages settings which are specific to voice calls Loading Loading @@ -53,4 +55,75 @@ interface ITelephony { * @throws EX_ILLEGAL_STATE If there was an error during switching. * @throws EX_ILLEGAL_STATE If there was an error during switching. */ */ void switchAudioMode(AudioMode mode); 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); } }
audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -90,6 +90,6 @@ union HapticGenerator { float maxAmplitude; float maxAmplitude; } } HapticScale hapticScale; HapticScale[] hapticScales; VibratorInformation vibratorInfo; VibratorInformation vibratorInfo; } }
audio/aidl/default/Telephony.cpp +33 −0 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,17 @@ #include "core-impl/Telephony.h" #include "core-impl/Telephony.h" using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Float; namespace aidl::android::hardware::audio::core { namespace aidl::android::hardware::audio::core { Telephony::Telephony() { mTelecomConfig.voiceVolume = Float{TelecomConfig::VOICE_VOLUME_MAX}; mTelecomConfig.ttyMode = TelecomConfig::TtyMode::OFF; mTelecomConfig.isHacEnabled = Boolean{false}; } ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector<AudioMode>* _aidl_return) { ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector<AudioMode>* _aidl_return) { *_aidl_return = mSupportedAudioModes; *_aidl_return = mSupportedAudioModes; LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return); LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return); Loading @@ -38,4 +47,28 @@ ndk::ScopedAStatus Telephony::switchAudioMode(AudioMode in_mode) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } ndk::ScopedAStatus Telephony::setTelecomConfig(const TelecomConfig& in_config, TelecomConfig* _aidl_return) { if (in_config.voiceVolume.has_value() && (in_config.voiceVolume.value().value < TelecomConfig::VOICE_VOLUME_MIN || in_config.voiceVolume.value().value > TelecomConfig::VOICE_VOLUME_MAX)) { LOG(ERROR) << __func__ << ": voice volume value is invalid: " << in_config.voiceVolume.value().value; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } if (in_config.voiceVolume.has_value()) { mTelecomConfig.voiceVolume = in_config.voiceVolume; } if (in_config.ttyMode != TelecomConfig::TtyMode::UNSPECIFIED) { mTelecomConfig.ttyMode = in_config.ttyMode; } if (in_config.isHacEnabled.has_value()) { mTelecomConfig.isHacEnabled = in_config.isHacEnabled; } *_aidl_return = mTelecomConfig; LOG(DEBUG) << __func__ << ": received " << in_config.toString() << ", returning " << _aidl_return->toString(); return ndk::ScopedAStatus::ok(); } } // namespace aidl::android::hardware::audio::core } // namespace aidl::android::hardware::audio::core