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

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

Implement audio devices and streams HAL delegating to legacy HAL

Changes made to the .hal definition:

  - introduce Effect ID returned by the IEffectsFactory that
    needs to be passed to IStream.{add|remove}Effect; otherwise
    it's impossible to retrieve the underlying HAL effect handle;

  - change "bus address" in DeviceAddress to "string" type;

  - fix signature of some methods w.r.t. returning Result;

  - remove unused "struct AudioPatch".

Bug: 30222631
Test: make
Change-Id: Icb51729ef57bb2a5b0b78609735e7481bc04f95c
parent f6c03bfc
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -180,19 +180,20 @@ interface IDevice {

    /*
     * Gets the HW synchronization source of the device. Calling this method is
     * equivalent to getting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy
     * HAL.
     * equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
     *
     * @return retval operation completion status.
     * @return hwAvSync HW synchronization source
     */
    getHwAvSync() generates (Result retval, AudioHwSync hwAvSync);
    getHwAvSync() generates (AudioHwSync hwAvSync);

    /*
     * Sets whether the screen is on. Calling this method is equivalent to
     * setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
     *
     * @param turnedOn whether the screen is turned on.
     * @return retval operation completion status.
     */
    setScreenState(bool turnedOn);
    setScreenState(bool turnedOn) generates (Result retval);

    /*
     * Generic method for retrieving vendor-specific parameter values.
+7 −6
Original line number Diff line number Diff line
@@ -134,18 +134,20 @@ interface IStream {
    /*
     * Applies audio effect to the stream.
     *
     * @param effect the effect to apply.
     * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
     *                 the effect to apply.
     * @return retval operation completion status.
     */
    addEffect(IEffect effect) generates (Result retval);
    addEffect(uint64_t effectId) generates (Result retval);

    /*
     * Stops application of the effect to the stream.
     *
     * @param effect the effect to apply.
     * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
     *                 the effect to remove.
     * @return retval operation completion status.
     */
    removeEffect(IEffect effect) generates (Result retval);
    removeEffect(uint64_t effectId) generates (Result retval);

    /*
     * Put the audio hardware input/output into standby mode.
@@ -158,10 +160,9 @@ interface IStream {
    /*
     * Return the set of device(s) which this stream is connected to.
     *
     * @return retval operation completion status.
     * @return device set of device(s) which this stream is connected to.
     */
    getDevice() generates (Result retval, AudioDevice device);
    getDevice() generates (AudioDevice device);

    /*
     * Connects the stream to the device.
+1 −2
Original line number Diff line number Diff line
@@ -61,10 +61,9 @@ interface IStreamIn extends IStream {
     * typically occurs when the user space process is blocked longer than the
     * capacity of audio driver buffers.
     *
     * @return retval operation completion status.
     * @return framesLost the number of input audio frames lost.
     */
    getInputFramesLost() generates (Result retval, uint32_t framesLost);
    getInputFramesLost() generates (uint32_t framesLost);

    /**
     * Return a recent count of the number of audio frames received and the
+5 −5
Original line number Diff line number Diff line
@@ -142,12 +142,12 @@ interface IStreamOut extends IStream {
     * 'setCallback' has not been called, then 'drain' must block until
     * completion.
     *
     * If 'type' is 'AUDIO_DRAIN_ALL', the drain completes when all previously
     * written data has been played.
     * If 'type' is 'ALL', the drain completes when all previously written data
     * has been played.
     *
     * If 'type' is 'AUDIO_DRAIN_EARLY_NOTIFY', the drain completes shortly
     * before all data for the current track has played to allow time for the
     * framework to perform a gapless track switch.
     * If 'type' is 'EARLY_NOTIFY', the drain completes shortly before all data
     * for the current track has played to allow time for the framework to
     * perform a gapless track switch.
     *
     * Drain must return immediately on 'stop' and 'flush' calls.
     *
+41 −8
Original line number Diff line number Diff line
@@ -16,6 +16,37 @@

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.audio@2.0-impl
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
    Conversions.cpp \
    Device.cpp \
    DevicesFactory.cpp \
    ParametersUtil.cpp \
    PrimaryDevice.cpp \
    Stream.cpp \
    StreamIn.cpp \
    StreamOut.cpp \

LOCAL_SHARED_LIBRARIES := \
    libhidl \
    libhwbinder \
    libutils \
    libhardware \
    liblog \
    android.hardware.audio@2.0 \
    android.hardware.audio.common@2.0 \
    android.hardware.audio.common@2.0-util \

LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper

include $(BUILD_SHARED_LIBRARY)

#
# Service
#

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.audio@2.0-service
LOCAL_INIT_RC := android.hardware.audio@2.0-service.rc
@@ -29,8 +60,10 @@ LOCAL_SHARED_LIBRARIES := \
    libhwbinder \
    libutils \
    libhardware \
    android.hardware.audio@2.0 \
    android.hardware.audio.common@2.0 \
    android.hardware.audio.effect@2.0 \
    android.hardware.soundtrigger@2.0 \
  android.hardware.audio.common@2.0

ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
LOCAL_MULTILIB := 32
Loading