Merge "Add ALLM and Content types in hwc2"
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 3366e17..a2809ba 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -207,6 +207,8 @@
 // Note that EffectsFactory.c only checks the major version component, so changes to the minor
 // number can only be used for fully backwards compatible changes
 #define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_0 EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_1 EFFECT_MAKE_API_VERSION(3,1)
 
 #define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T'))
 
@@ -297,6 +299,48 @@
     ////////////////////////////////////////////////////////////////////////////////
     int32_t (*get_descriptor)(const effect_uuid_t *uuid,
                               effect_descriptor_t *pDescriptor);
+
+    ////////////////////////////////////////////////////////////////////////////////
+    //
+    //    Function:        create_effect_3_1
+    //
+    //    Description:    Creates an effect engine of the specified implementation uuid and
+    //          returns an effect control interface on this engine. The function will allocate the
+    //          resources for an instance of the requested effect engine and return
+    //          a handle on the effect control interface.
+    //
+    //    Input:
+    //          uuid:    pointer to the effect uuid.
+    //          sessionId:  audio session to which this effect instance will be attached.
+    //              All effects created with the same session ID are connected in series and process
+    //              the same signal stream. Knowing that two effects are part of the same effect
+    //              chain can help the library implement some kind of optimizations.
+    //          ioId:   identifies the output or input stream this effect is directed to in
+    //              audio HAL.
+    //              For future use especially with tunneled HW accelerated effects
+    //          deviceId:  identifies the sink or source device this effect is directed to in
+    //              audio HAL. Must be specified if sessionId is AUDIO_SESSION_DEVICE and is
+    //              ignored otherwise.
+    //              deviceId is the audio_port_handle_t used for the device when the audio
+    //              patch is created at the audio HAL.
+    //
+    //    Input/Output:
+    //          pHandle:        address where to return the effect interface handle.
+    //
+    //    Output:
+    //        returned value:    0          successful operation.
+    //                          -ENODEV     library failed to initialize
+    //                          -EINVAL     invalid pEffectUuid or pHandle
+    //                          -ENOENT     no effect with this uuid found
+    //        *pHandle:         updated with the effect interface handle.
+    //
+    ////////////////////////////////////////////////////////////////////////////////
+    int32_t (*create_effect_3_1)(const effect_uuid_t *uuid,
+                         int32_t sessionId,
+                         int32_t ioId,
+                         int32_t deviceId,
+                         effect_handle_t *pHandle);
+
 } audio_effect_library_t;
 
 // Name of the hal_module_info
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index 99346ef..573ada8 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -41,7 +41,8 @@
 #define SOUND_TRIGGER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
 #define SOUND_TRIGGER_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
 #define SOUND_TRIGGER_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION(1, 2)
-#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_2
+#define SOUND_TRIGGER_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION(1, 3)
+#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_3
 
 /**
  * List of known sound trigger HAL modules. This is the base name of the sound_trigger HAL
@@ -123,6 +124,37 @@
      */
     int (*get_model_state)(const struct sound_trigger_hw_device *dev,
                            sound_model_handle_t sound_model_handle);
+
+    /* Set a model specific ModelParameter with the given value. This parameter
+     * will keep its value for the duration the model is loaded regardless of starting and stopping
+     * recognition. Once the model is unloaded, the value will be lost.
+     * Returns 0 or an error code.
+     * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+     */
+    int (*set_parameter)(const struct sound_trigger_hw_device *dev,
+                           sound_model_handle_t sound_model_handle,
+                           sound_trigger_model_parameter_t model_param, int32_t value);
+
+    /* Get a model specific ModelParameter. This parameter will keep its value
+     * for the duration the model is loaded regardless of starting and stopping recognition.
+     * Once the model is unloaded, the value will be lost. If the value is not set, a default
+     * value is returned. See sound_trigger_model_parameter_t for parameter default values.
+     * Returns 0 or an error code. On return 0, value pointer will be set.
+     * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+     */
+    int (*get_parameter)(const struct sound_trigger_hw_device *dev,
+                           sound_model_handle_t sound_model_handle,
+                           sound_trigger_model_parameter_t model_param, int32_t* value);
+
+    /* Get supported parameter attributes with respect to the provided model
+     * handle. Along with determining the valid range, this API is also used
+     * to determine if a given parameter ID is supported at all by the
+     * modelHandle for use with getParameter and setParameter APIs.
+     */
+    int (*query_parameter)(const struct sound_trigger_hw_device *dev,
+                           sound_model_handle_t sound_model_handle,
+                           sound_trigger_model_parameter_t model_param,
+                           sound_trigger_model_parameter_range_t* param_range);
 };
 
 typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;