hal: Add support to close streams on power policy callback
* Close existing streams during power policy disable callback
* Stop new streams from starting if current policy is in disabled state
Signed-off-by: Shubhasini Sugumaran <quic_c_shubsu@quicinc.com>
Change-Id: I4960e336f03086d1322708e155a4a4f02098b3fb
diff --git a/hal/audio_extn/PowerPolicyClient.h b/hal/audio_extn/PowerPolicyClient.h
index da0b434..c5308e3 100644
--- a/hal/audio_extn/PowerPolicyClient.h
+++ b/hal/audio_extn/PowerPolicyClient.h
@@ -32,11 +32,19 @@
#include "audio_hal_plugin.h"
typedef int32_t (*hal_plugin_send_msg_t) (audio_hal_plugin_msg_type_t, void*, uint32_t);
+typedef void (*fp_in_set_power_policy_t) (uint8_t);
+typedef void (*fp_out_set_power_policy_t) (uint8_t);
+
+typedef struct power_policy_init_config {
+ fp_in_set_power_policy_t fp_in_set_power_policy;
+ fp_out_set_power_policy_t fp_out_set_power_policy;
+} power_policy_init_config_t;
+
class PowerPolicyClient
: public ::android::frameworks::automotive::powerpolicy::PowerPolicyClientBase {
public:
- explicit PowerPolicyClient();
+ explicit PowerPolicyClient(power_policy_init_config init_config);
~PowerPolicyClient();
void onInitFailed();
@@ -48,6 +56,8 @@
private:
void* plugin_handle;
hal_plugin_send_msg_t hal_plugin_send_msg;
+ fp_out_set_power_policy_t fp_out_set_power_policy;
+ fp_in_set_power_policy_t fp_in_set_power_policy;
};
#endif // QTI_AUDIO_POWERPOLICYCLIENT_H_