From eacb99697f332fd2559eb016773e189365aead0f Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Wed, 31 Jan 2018 18:26:45 -0800 Subject: [PATCH] Audio V4: More fixes of the audio 2.0 API Remove unnecessary Result typedef. Make bufferSizeFrames and burstSizeFrames unsigned as they should not be negative. Remove legacy AudioInterleave. Remove implicit callflow annotation. Make EffectConfigParameters a bitfield. Bug: 38184704 Test: hardware/interfaces/update-makefiles.py Change-Id: I33e6f7869d20ca0cad4123f32347754e5a514caa Signed-off-by: Kevin Rocard --- audio/4.0/IDevice.hal | 2 -- audio/4.0/IDevicesFactory.hal | 2 -- audio/4.0/IPrimaryDevice.hal | 2 -- audio/4.0/IStream.hal | 2 -- audio/4.0/IStreamIn.hal | 2 -- audio/4.0/IStreamOut.hal | 2 -- audio/4.0/types.hal | 4 ++-- audio/common/4.0/types.hal | 22 ++++------------------ audio/effect/4.0/IEffect.hal | 25 ++----------------------- audio/effect/4.0/types.hal | 4 ++-- 10 files changed, 10 insertions(+), 57 deletions(-) diff --git a/audio/4.0/IDevice.hal b/audio/4.0/IDevice.hal index 8af4ee176a..bb585688d9 100644 --- a/audio/4.0/IDevice.hal +++ b/audio/4.0/IDevice.hal @@ -21,8 +21,6 @@ import IStreamIn; import IStreamOut; interface IDevice { - typedef android.hardware.audio@4.0::Result Result; - /** * Returns whether the audio hardware interface has been initialized. * diff --git a/audio/4.0/IDevicesFactory.hal b/audio/4.0/IDevicesFactory.hal index b884c6b97a..c552c6ddd2 100644 --- a/audio/4.0/IDevicesFactory.hal +++ b/audio/4.0/IDevicesFactory.hal @@ -20,8 +20,6 @@ import android.hardware.audio.common@4.0; import IDevice; interface IDevicesFactory { - typedef android.hardware.audio@4.0::Result Result; - /** Allows a HAL implementation to be split in multiple independent * devices (called module in the pre-treble API). * Note that this division is arbitrary and implementation are free diff --git a/audio/4.0/IPrimaryDevice.hal b/audio/4.0/IPrimaryDevice.hal index 4eafdbb18f..f3d904cdcb 100644 --- a/audio/4.0/IPrimaryDevice.hal +++ b/audio/4.0/IPrimaryDevice.hal @@ -20,8 +20,6 @@ import android.hardware.audio.common@4.0; import IDevice; interface IPrimaryDevice extends IDevice { - typedef android.hardware.audio@4.0::Result Result; - /** * Sets the audio volume of a voice call. * diff --git a/audio/4.0/IStream.hal b/audio/4.0/IStream.hal index 34e7a140c8..f05d7b04fa 100644 --- a/audio/4.0/IStream.hal +++ b/audio/4.0/IStream.hal @@ -20,8 +20,6 @@ import android.hardware.audio.common@4.0; import android.hardware.audio.effect@4.0::IEffect; interface IStream { - typedef android.hardware.audio@4.0::Result Result; - /** * Return the frame size (number of bytes per sample). * diff --git a/audio/4.0/IStreamIn.hal b/audio/4.0/IStreamIn.hal index 3b2dc25fcc..247e826db9 100644 --- a/audio/4.0/IStreamIn.hal +++ b/audio/4.0/IStreamIn.hal @@ -20,8 +20,6 @@ import android.hardware.audio.common@4.0; import IStream; interface IStreamIn extends IStream { - typedef android.hardware.audio@4.0::Result Result; - /** * Returns the source descriptor of the input stream. Calling this method is * equivalent to getting AUDIO_PARAMETER_STREAM_INPUT_SOURCE on the legacy diff --git a/audio/4.0/IStreamOut.hal b/audio/4.0/IStreamOut.hal index 585bffed66..3aa93fcb52 100644 --- a/audio/4.0/IStreamOut.hal +++ b/audio/4.0/IStreamOut.hal @@ -21,8 +21,6 @@ import IStream; import IStreamOutCallback; interface IStreamOut extends IStream { - typedef android.hardware.audio@4.0::Result Result; - /** * Return the audio hardware driver estimated latency in milliseconds. * diff --git a/audio/4.0/types.hal b/audio/4.0/types.hal index 50ebc57796..7853f3c3ab 100644 --- a/audio/4.0/types.hal +++ b/audio/4.0/types.hal @@ -93,9 +93,9 @@ struct MmapBufferInfo { /** Mmap memory buffer */ memory sharedMemory; /** Total buffer size in frames */ - int32_t bufferSizeFrames; + uint32_t bufferSizeFrames; /** Transfer size granularity in frames */ - int32_t burstSizeFrames; + uint32_t burstSizeFrames; /** Attributes describing the buffer. */ bitfield flags; }; diff --git a/audio/common/4.0/types.hal b/audio/common/4.0/types.hal index 2c6e0a3d65..d4c6efe2c7 100644 --- a/audio/common/4.0/types.hal +++ b/audio/common/4.0/types.hal @@ -470,23 +470,6 @@ enum AudioChannelMask : uint32_t { INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 1) }; - -/** - * Expresses the convention when stereo audio samples are stored interleaved - * in an array. This should improve readability by allowing code to use - * symbolic indices instead of hard-coded [0] and [1]. - * - * For multi-channel beyond stereo, the platform convention is that channels - * are interleaved in order from least significant channel mask bit to most - * significant channel mask bit, with unused bits skipped. Any exceptions - * to this convention will be noted at the appropriate API. - */ -@export(name="", value_prefix="AUDIO_INTERLEAVE_") -enum AudioInterleave : int32_t { - LEFT = 0, - RIGHT = 1, -}; - /** * Major modes for a mobile device. The current mode setting affects audio * routing. @@ -495,7 +478,9 @@ enum AudioInterleave : int32_t { enum AudioMode : int32_t { NORMAL = 0, RINGTONE = 1, + /** Calls handled by the telephony stack (Eg: PSTN). */ IN_CALL = 2, + /** Calls handled by apps (Eg: Hangout). */ IN_COMMUNICATION = 3, }; @@ -854,6 +839,7 @@ struct AudioPortConfig { struct AudioPortDeviceExt { AudioModuleHandle hwModule; // module the device is attached to AudioDevice type; + /** 32 byte string identifying the port. */ uint8_t[32] address; }; @@ -864,7 +850,7 @@ struct AudioPortDeviceExt { enum AudioMixLatencyClass : int32_t { LOW, NORMAL -} ; +}; struct AudioPortMixExt { AudioModuleHandle hwModule; // module the stream is attached to diff --git a/audio/effect/4.0/IEffect.hal b/audio/effect/4.0/IEffect.hal index afc0237797..d1d949614f 100644 --- a/audio/effect/4.0/IEffect.hal +++ b/audio/effect/4.0/IEffect.hal @@ -26,7 +26,6 @@ interface IEffect { * @return retval operation completion status. */ @entry - @callflow(next={"*"}) init() generates (Result retval); /** @@ -39,7 +38,6 @@ interface IEffect { * @param outputBufferProvider optional buffer provider reference. * @return retval operation completion status. */ - @callflow(next={"*"}) setConfig(EffectConfig config, IEffectBufferProviderCallback inputBufferProvider, IEffectBufferProviderCallback outputBufferProvider) @@ -51,7 +49,6 @@ interface IEffect { * * @return retval operation completion status. */ - @callflow(next={"*"}) reset() generates (Result retval); /** @@ -81,7 +78,6 @@ interface IEffect { * @param device output device specification. * @return retval operation completion status. */ - @callflow(next={"*"}) setDevice(bitfield device) generates (Result retval); /** @@ -99,7 +95,6 @@ interface IEffect { * @return result updated volume values. * @return retval operation completion status. */ - @callflow(next={"*"}) setAndGetVolume(vec volumes) generates (Result retval, vec result); @@ -124,7 +119,6 @@ interface IEffect { * @param mode desired audio mode. * @return retval operation completion status. */ - @callflow(next={"*"}) setAudioMode(AudioMode mode) generates (Result retval); /** @@ -137,7 +131,6 @@ interface IEffect { * @param outputBufferProvider optional buffer provider reference. * @return retval operation completion status. */ - @callflow(next={"*"}) setConfigReverse(EffectConfig config, IEffectBufferProviderCallback inputBufferProvider, IEffectBufferProviderCallback outputBufferProvider) @@ -154,7 +147,6 @@ interface IEffect { * @param device input device specification. * @return retval operation completion status. */ - @callflow(next={"*"}) setInputDevice(bitfield device) generates (Result retval); /** @@ -163,7 +155,6 @@ interface IEffect { * @return retval operation completion status. * @return config configuration descriptor. */ - @callflow(next={"*"}) getConfig() generates (Result retval, EffectConfig config); /** @@ -173,7 +164,6 @@ interface IEffect { * @return retval operation completion status. * @return config configuration descriptor. */ - @callflow(next={"*"}) getConfigReverse() generates (Result retval, EffectConfig config); /** @@ -186,7 +176,6 @@ interface IEffect { * the number of supported combinations exceeds 'maxConfigs'. * @return result list of configuration descriptors. */ - @callflow(next={"*"}) getSupportedAuxChannelsConfigs(uint32_t maxConfigs) generates (Result retval, vec result); @@ -197,7 +186,6 @@ interface IEffect { * NOT_SUPPORTED code. * @return result configuration descriptor. */ - @callflow(next={"*"}) getAuxChannelsConfig() generates (Result retval, EffectAuxChannelsConfig result); @@ -207,7 +195,6 @@ interface IEffect { * @return retval operation completion status; absence of the feature * support is indicated using NOT_SUPPORTED code. */ - @callflow(next={"*"}) setAuxChannelsConfig(EffectAuxChannelsConfig config) generates (Result retval); @@ -221,7 +208,6 @@ interface IEffect { * @param source source descriptor. * @return retval operation completion status. */ - @callflow(next={"*"}) setAudioSource(AudioSource source) generates (Result retval); /** @@ -232,7 +218,6 @@ interface IEffect { * @param param effect offload descriptor. * @return retval operation completion status. */ - @callflow(next={"*"}) offload(EffectOffloadParameter param) generates (Result retval); /** @@ -241,7 +226,6 @@ interface IEffect { * @return retval operation completion status. * @return descriptor effect descriptor. */ - @callflow(next={"*"}) getDescriptor() generates (Result retval, EffectDescriptor descriptor); /** @@ -285,9 +269,8 @@ interface IEffect { * INVALID_ARGUMENTS if there was a problem with mapping * any of the buffers. */ - @callflow(next={"*"}) - setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) generates ( - Result retval); + setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) + generates (Result retval); /** * Execute a vendor specific command on the effect. The command code @@ -327,7 +310,6 @@ interface IEffect { * @param value the value of the parameter. * @return retval operation completion status. */ - @callflow(next={"*"}) setParameter(vec parameter, vec value) generates (Result retval); @@ -349,7 +331,6 @@ interface IEffect { * @return retval operation completion status. * @return result the value of the parameter. */ - @callflow(next={"*"}) getParameter(vec parameter, uint32_t valueMaxSize) generates (Result retval, vec value); @@ -375,7 +356,6 @@ interface IEffect { * @return configsCount number of configs returned. * @return configsData data for all the configs returned. */ - @callflow(next={"*"}) getSupportedConfigsForFeature( uint32_t featureId, uint32_t maxConfigs, @@ -402,7 +382,6 @@ interface IEffect { * @return retval operation completion status. * @return configData config data. */ - @callflow(next={"*"}) getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize) generates (Result retval, vec configData); diff --git a/audio/effect/4.0/types.hal b/audio/effect/4.0/types.hal index 57f96e30e9..0f76601493 100644 --- a/audio/effect/4.0/types.hal +++ b/audio/effect/4.0/types.hal @@ -245,7 +245,7 @@ enum EffectConfigParameters : int32_t { CHANNELS = 0x0004, // channels FORMAT = 0x0008, // format ACC_MODE = 0x0010, // accessMode - ALL = BUFFER | SMP_RATE | CHANNELS | FORMAT | ACC_MODE + // Note that the 2.0 ALL have been moved to an helper function }; /** @@ -258,7 +258,7 @@ struct EffectBufferConfig { bitfield channels; AudioFormat format; EffectBufferAccess accessMode; - EffectConfigParameters mask; + bitfield mask; }; struct EffectConfig {